{include file='common/head'}
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a >首页</a>
        <a >演示</a>
        <a>
          <cite>匹配成功</cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="{:url('admin/indent/succdk')}" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <form enctype="multipart/form-data" id="formDate">
            <input type="file" name="excel" style="color: #868686;" required>
            <input type="button" class="layui-btn layui-btn-sm" value="自动对账" id="ti">
            <span style="color: #868686">/**仅支持csv文件解析**/</span>
        </form>
    </div>
    <table class="layui-table">
        <thead>
        <tr style="text-align: center">
            <th style="text-align: center">序号NO</th>
            <th style="text-align: center">订单编号</th>
            <th style="text-align: center">会员昵称</th>
            <th style="text-align: center">信用额度</th>
            <th style="text-align: center">订单价格</th>
            <th style="text-align: center">支付方式</th>
            <th style="text-align: center">打款时间</th>
            <th style="text-align: center">订单状态</th>
            <th style="text-align: center">操作</th>
        </tr>
        </thead>
        <tbody>
        {volist name="indent" id="b" key='key' }
        <tr style="text-align: center">
            <td>{$b.tid}</td>
            <td>{$b.t_number}</td>
            <td>{$b.iuser.u_name}</td>
            <td>{$b.iuser.u_money}元</td>
            <td>{$b.t_money}元</td>
            <td>{$b.z_paytype.z_type}</td>
            <td>{$b.z_datime}</td>
            {if $b.sid == 4}<td style="color: blue">打款成功</td>{/if}
            <td class="td-manage">
                <a title="确认收款" href="javascript:;"  onclick="member_stop2(this,'{$b.uid},{$b.tid}')"  class="layui-btn   layui-btn-radius layui-btn-danger layui-btn-sm"><span style="color: #EFEEF0">确认收款</span>
                </a>
            </td>
        </tr>
        {/volist}
        </tbody>
    </table>
    <div class="page">
        <div>
            {$page}
        </div>
    </div>

</div>
<script>
    function member_stop2(obj,id){
        layer.confirm('确认已收到款吗？',function(index){
            var sid=id;
            var sid=id.split(',');
            var uid=sid['0'];
            var tid=sid['1'];
            $.ajax({
                url:'{:URL("indent/updatepay")}',
                data:{uid:uid,tid:tid},
                type:'post',
                dataType:'json',
                success:function(msg){
                    if(msg==1){
                        layer.msg('收款成功',{icon: 1,time:6000});
                        window.location.reload();//刷新父级窗口
                    }
                }
            });
        });
    }
    $("#formDate").click(function () {
        alert(1);
            var form = new FormData(document.getElementsById('dz'));
            $.ajax({
                url:"{:URL('Indent/uplode')}",
                type:"post",
                data:form,
                processData:false,
                contentType:false,
                success:function(msg){
                    if(msg.code==1){
                        layer.msg("对账结束！",{icon: 6},function () {
                            //获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.location.reload();//刷新父级窗口

                        });
                        return false;
                    }else{
                        layer.msg("失败！",{icon: 6},function () {
                            //获得frame索引
                            var index = parent.layer.getFrameIndex(window.name);
                            //关闭当前frame
                            parent.layer.close(index);
                            window.location.reload();//刷新父级窗口

                        });
                        return false;
                    }
                },
            });
    }
</script>

</body>

</html>